package com.ruoyi.web.controller.api;

import com.alipay.api.AlipayApiException;
import com.ruoyi.common.core.page.ResponseResult;
import com.ruoyi.system.dto.ApiChinaOrderPayAddDto;
import com.ruoyi.system.dto.ApiNotifyDto;
import com.ruoyi.system.service.OrderPayService;
import com.ruoyi.web.controller.app.AppController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "开放接口---代付订单")
@RestController
@RequestMapping("/api/orderPay")
public class OrderPayController extends AppController {

    @Resource
    private OrderPayService orderPayService;

    @ApiOperation(value = "创建代付订单")
    @PostMapping("/create")
    public ResponseResult create(@Valid @RequestBody ApiChinaOrderPayAddDto apiBxOrderPayAddDto) {
        orderPayService.createApiOrder(apiBxOrderPayAddDto);
        return this.setSuccessResult();
    }




    @ApiOperation(value = "上游系统回调", hidden = true)
    @RequestMapping("/notifyMe")
    public String notifyMe(@RequestBody ApiNotifyDto apiNotifyDto) throws AlipayApiException {
        return "success";
    }


}
